﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace wmkMacro
{
    class RecordActions
    {
        private readonly HashSet<RecordStep> recordActions = new HashSet<RecordStep>();
        private Stopwatch delayStopwatch = new Stopwatch();
        private Boolean isRecording = false;

        public Boolean IsRecording
        {
            get { return isRecording; }
            set
            {
                isRecording = value;
                delayStopwatch.Stop();
                delayStopwatch.Reset();
            }
        }

        public HashSet<RecordStep> Items { get { return this.recordActions; } }

        public void Add(RecordStep recordStep)
        {
            delayStopwatch.Stop();
            Int64 delay = delayStopwatch.ElapsedMilliseconds;
            delayStopwatch.Reset();
            recordStep.Delay = delay;
            this.recordActions.Add(recordStep);
            delayStopwatch.Start();
        }
        
    }
}
